<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/1 0001
 * Time: 上午 10:38
 */
header("Access-Control-Allow-Origin:*");
    if(!empty($_POST)){
        $name=$_POST["name"];
        $conn = new mysqli("127.0.0.1","root","","cart");
        mysqli_query($conn,"set names utf8");
    //print_r($conn->connect_error);
        $sql = "INSERT INTO cartlist(proname,pronum)VALUES('".$name."','".$_POST["number"]."')";
       // print_r($sql);
        $result = $conn->query($sql);
        if($result){
            $arr = array("msg"=>"success");
            print_r(json_encode($arr));
        }else{
            $arr = array("msg"=>"error");
            print_r(json_encode($arr));
        }


        $conn->close();

    }
